package com.sh;


import java.lang.reflect.InvocationTargetException;

public class Test {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        //这个类class的路径
        MyClassLoader myClassLoader = new MyClassLoader();
//        //类的全限定
        String classPath = "com.sh.Log";
//
        //加载Log这个class文件
        Class<?> log = myClassLoader.loadClass(classPath);
        Object o1 = log.newInstance();
        Log o = (Log) o1;
//        System.out.println(o);
//        System.out.println(log);
//        System.out.println("类加载器是:" + log.getClassLoader());



//        Test test = new Test();
//        ClassLoader classLoader = test.getClass().getClassLoader();
//        Class aClass = classLoader.loadClass("com.sh.Log");
//        Object o = aClass.newInstance();
//        Log log1 = (Log) o;
//        log1.info("hello");



    }
}
